package com.piggy.sys.api.factory;

import com.piggy.common.core.domain.R;
import com.piggy.sys.api.RemoteDeptService;
import com.piggy.sys.api.RemoteDistrictService;
import com.piggy.sys.api.domain.SysDept;
import com.piggy.sys.api.vo.BaseAddressVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 用户服务降级处理98
 *
 * @author shark
 */
@Component
public class RemoteDistrictFallbackFactory implements FallbackFactory<RemoteDistrictService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteDistrictFallbackFactory.class);

    @Override
    public RemoteDistrictService create(Throwable throwable) {
        log.error("服务调用失败:{}", throwable.getMessage());

        return new RemoteDistrictService()
        {
            @Override
            public R<BaseAddressVo> getDistrictVo(String districtId, String source) {
                return null;
            }

            @Override
            public R<Map<String, String>> getDistrictMap(List<String> districtIds, String source) {
                return null;
            }
        };
    }
}
